package com.sm.service;

import com.sm.dao.LikeHappyRequestMapper;
import com.sm.model.LikeHappyRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LikeHappyRequestService {

    @Autowired
    private LikeHappyRequestMapper likeHappyRequestMapper;

    /**
     * 新增点赞记录
     */
    public Integer like(LikeHappyRequest likeHappyRequest){
        return likeHappyRequestMapper.insertSelective(likeHappyRequest);
    }

    /**
     * 根据用户id和问题的id查询这条点赞记录
     */
    public LikeHappyRequest selectIsExist(Integer userId,Integer requestId,Integer likeType){
        return likeHappyRequestMapper.selectIsExist(userId, requestId,likeType);
    }

    /**
     * 取消幸福问答问题/评论点赞
     */
    public Integer cancelLike(Integer userId,Integer requestId,Integer likeType){
        return likeHappyRequestMapper.cancelLike(userId, requestId, likeType);
    }
}
